package bean.config;

import bean.dao.impl.UserDaoImpl;
import bean.domain.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author peter
 * @date 2021/12/4 上午2:19
 */
@Configuration
public class UserDaoConfig {

    @Bean(name = "userDaoAnnotion")
    // @Scope("prototype")
    public UserDaoImpl userDaoAnnotion() {
        UserDaoImpl userDao = new UserDaoImpl();
        User user = new User();
        userDao.setUser(user);
        return userDao;
    }

    public UserDaoConfig(){
        System.out.println("UserDaoConfig constructor");
    }

    @PostConstruct
    public void init() {
        System.out.println("UserDaoConfig PostConstruct init method");
    }

    @PreDestroy
    public void destory() {
        System.out.println("UserDaoConfig destory method");
    }
}
